import { reqCategoryList,reqGetBannerList,reqGetFloorList  } from "@/api"
const state = {
    categoryList:[],
    bannerList:[],
    floorList:[]
}
const actions ={
   async getCategoryList({commit}){
        let result  = await reqCategoryList()
        commit('GETCATEGORYLIST',result.data)
    },
    async getBannerList({commit}){
        let result = await reqGetBannerList();
        if(result.code == 200){
            commit('GETBANNERLIST',result.data)
        }
    },
    async getFloorList(miniState){
        let result = await reqGetFloorList();
        if(result.code == 200){
            miniState.commit('GETFLOORLIST',result.data)
        }
    }
}
const mutations ={
    GETCATEGORYLIST(state,value){
        state.categoryList = value
    },
    GETBANNERLIST(state,bannerList){
        state.bannerList = bannerList
    },
    GETFLOORLIST(state,floorList){[
        state.floorList = floorList
    ]}
}
const getters ={}
export default {
    state,
    actions,
    mutations,
    getters
}